<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    //【1】函数创建的四种方法-函数声明
    function sum1(num1,num2){
        return num1 + num2;
    }
    //【2】函数表达式
    var sum2 = function(num1,num2){
        return num1 + num2;
    }
    //【3】构造函数
    var sum3 = new Function('num1','num2','return num1 + num2');
    console.log(sum3(1,3));//4

    //【3-1】函数的名字只是一个指针，当变量承接后，原有指针释放，不影响现在指针的引用
    function sum4(num1,num2){
        return num1 + num2;
    }
    var sum5 = sum4;
    sum4 = null;
    alert(sum5(3,5));//弹出8
    </script>
</body>
</html>